package com.service.admin.product.controller;

import com.service.admin.product.controller.req.ProductHrComboTypeAddReq;
import com.service.admin.product.controller.req.ProductHrComboTypePageReq;
import com.service.admin.product.service.ProductHrComboTypeService;
import com.service.core.rest.BaseController;
import com.service.core.rest.response.BaseResponse;
import com.service.core.rest.response.CommonPageRep;
import com.service.core.rest.response.PageResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 产品类型
 */
@Slf4j
@Api(tags = "产品类型产品")
@RestController
@RequestMapping("product-hr-combo-type")
public class ProductHrComboTypeController extends BaseController {


    @Autowired
    private ProductHrComboTypeService productHrComboTypeService;

    @ApiOperation("分页")
    @PostMapping("page")
    public PageResponse page(@RequestBody ProductHrComboTypePageReq productHrComboTypePageReq) {
        CommonPageRep result = productHrComboTypeService.page(productHrComboTypePageReq);
        return successQueryPageResponse(result);
    }

    @ApiOperation("删除")
    @DeleteMapping("delete/{typeId}")
    public BaseResponse delete(@PathVariable Integer typeId) {
        productHrComboTypeService.delete(typeId);
        return successDeleteBaseResponse();
    }

    @ApiOperation("添加")
    @PostMapping("add")
    public BaseResponse add(@RequestBody ProductHrComboTypeAddReq productHrComboTypeAddReq) {
        productHrComboTypeService.add(productHrComboTypeAddReq);
        return successSaveBaseResponse();
    }

    @ApiOperation("查询所有")
    @PostMapping("list")
    public BaseResponse list() {
        return successQueryOneResponse(productHrComboTypeService.list());
    }

}
